package sc;

import java.util.ArrayList;

/**
 * @Author admin
 * @Date 2019/3/29 10:46
 */
public class UserDaoimp implements UesrDao{
    ArrayList<Uesr> arrayList=new ArrayList<Uesr>();
    @Override
    public void register(Uesr uesr) {

        arrayList.add(uesr);
        System.out.println("注册成功");
    }

    @Override
    public boolean login(String name, String password) {
        for (int i = 0; i < arrayList.size(); i++) {
            Uesr uesr = arrayList.get(i);
            if (uesr.getUsername().equals(name) && uesr.getPassword().equals(password)) {
                return true;
            }
        }

        return false;
    }
}
